﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using treadmillProject.src.model;

namespace GUI.src {
    public class StatusPanel {
        private DockPanel myDockPanel;

        private List<TrainingData> trainingData = TrainingSession.trainingData;

        private Label[] myLabelArray = new Label[6];

        public StatusPanel(Label[] labelArray) {
            Console.WriteLine("StatusPanel init...");
            myLabelArray = labelArray;
            //this.CurrentPulse = CurrentPulse;
        }

        public Label CurrentPulse { get; set; }
        public Label CurrentSpeed { get; set; }
        public Label CurrentGear { get; set; }

        public Label MaxPulse { get; set; }
        public Label MaxSpeed { get; set; }
        public Label MaxGear { get; set; }


        public void OnUpdate() {
            trainingData = TrainingSession.trainingData;
            myLabelArray[3].Content = "Max Pulse: " + Pulse.MaxPulse;
            myLabelArray[4].Content = "Max Speed: " + Speed.MaxSpeed;
            myLabelArray[5].Content = "Max Gear: " + Gear.MaxGear;

            if (trainingData.Count > 0) {
                myLabelArray[0].Content = "Current Pulse: " + trainingData[trainingData.Count - 1].pulse.PulseData;
                myLabelArray[1].Content = "Current Speed: " + trainingData[trainingData.Count - 1].speed.SpeedData;
                myLabelArray[2].Content = "Current Gear: " + trainingData[trainingData.Count - 1].gear.GearData;
            } else {
                myLabelArray[0].Content = "Current Pulse: 0";
                myLabelArray[1].Content = "Current Speed: 0";
                myLabelArray[2].Content = "Current Gear: 0";
            }
        }
    }
}